<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'doReg.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <h1>获得提交的信息</h1>
    <%
    	request.setCharacterEncoding("utf-8");
    	String ip=request.getRemoteAddr();
    	String name=request.getParameter("uname");
    	String p=request.getParameter("upass");
    	String p2=request.getParameter("repass");
    	String mail=request.getParameter("uemail");
    	String[]like=request.getParameterValues("like");
     %>
     <h2>您输入的信息如下</h2>
     <h2>您的ip:<%=ip%></h2>
     <h2>您的name:<%=name%></h2>
     <h2>您的pass:<%=p%></h2>
     <h2>您的repass:<%=p2%></h2>
     <h2>您的邮件地址:<%=mail%></h2>
     <h2>
     你的爱好是：<%
     	for(int i=0;like!=null&&i<like.length;i++)
     		out.print(like[i]+"<br/>");
      %>
     </h2>
     <%
       if(name.length()>3&&p.length()>6){
       	 out.println("注册信息填的好"); 
       	 request.setAttribute("nowuser", name);
       	//request.getRequestDispatcher("/welcome.jsp").forward(request,response);
       	  response.sendRedirect("welcome.jsp?uname="+name);
       }else{ 
         out.print("信息填写的不合适，太短了，<a href='javascript:history.back();'>返回</a>");
         request.setAttribute("msg", "信息填写的不合适，太短了");
         request.getRequestDispatcher("/reg.jsp").forward(request,response);
        	
       }
      %>
  </body>
</html>
